<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加一级区域</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/platform.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=store&prefix=3g_platform_shop-rent_op&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num">WWP31100</span>
       </div>
    </div>
    <div class="content m-top">
        <div class="content-1">
            <div class="content-1-1">
                <img alt="粤西农批" src="<%=basepath%>images/mmzs.png" class="img-1">
            </div>
            <div class="content-1-2"><h3>粤西农副产品综合交易中心</h3></div>
        </div>
    </div>
    <div class="blank-z"></div>
    <div class="zone-1">
        <div class="zone-1-1">
           <ul>
              <c:forEach items="${markets}" var="ms">
                <li><a href="javascript:void(0)">${ms.storeName}</a></li>     
              </c:forEach>
              <li class="li-add" id="add"><a href="javascript:void(0)">✚</a></li>
           </ul>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    /*错误提示*/
    $(function(){
        var error = "${requestScope.returnMsg}";
        if(error != "" && error != "成功!"){
            layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
        }
    });
    /*增加区域类别*/
    $(function(){
        $("#add").click(function(){
            layer.prompt({
                title: '请输入区域类别',
                formType: 0
            }, function(text){
                if(text != ""){
                    layer.load();
                    $.ajax({
                        type:"post",
                        url:"/wape-web/api/core/centerService",
                        data:{
                            serviceCode:"MMZS21101",
                            storeName:text
                        },
                        success:function(data){
                            var add = eval("("+data+")");
                            if(add.returnCode == "200"){
                                $("#add").before("<li><a href='javascript:void(0)'>"+text+"</a></li>");
                            }
                            else{
                                layer.msg(add.returnMsg,{shadeClose:true,shade:0.1,time:2000});
                            }
                        }
                    });
                }
                layer.closeAll();
            });
        })
    });
</script>
</html>
